require.config({
    baseUrl: '/static',
    paths: {
        jquery: './lib/jquery',
        bootstrap: './lib/bootstrap.min',
        jqueryDataTables: './lib/jqueryDataTables',
        dataTablesBootstrap: './lib/dataTablesBootstrap',
        newIframe: './lib/common/newIframe', // 生成标签页
        tableOption: './lib/common/tableOption', // 列表内容选择 ， 删除等操作
        preventBack: './lib/common/preventBack', //阻止浏览器后退
        validate: './lib/jquery.validate.min',
        messagesZh: './lib/messagesZh',
        checkSelect: './lib/common/checkSelect',
        checkOne: './lib/common/checkSingleSelect',
        jqueryUI: './js/jquery-ui',
        tableInit: './lib/common/tableInit', // 初始化dataTable表格插件
        tableSearch: './lib/common/tableSearch',
        validateExtend: './lib/common/validateExtend',
        
    },

    shim: {
        bootstrap: {
            deps: ['jquery'],
            exports: 'bootstrap'
        },
        validate: {
            deps: ['jquery'],
            exports: 'validate',
        },
        addtionalMethod: {
            deps: ['jquery', 'validate'],
            exports: 'addtionalMethod'
        },
        messagesZh: {
            deps: ['jquery', 'validate'],
            exports: 'messagesZh'
        },
        jqueryDataTables: {
            deps: ['jquery'],
            exports: 'jqueryDataTables',
        },

        dataTablesBootstrap: {
            deps: ['bootstrap', 'jqueryDataTables'],
            exports: 'dataTablesBootstrap'
        },
        validateExtend: {
            deps: ['jquery', 'validate'],
            exports: 'validateExtend'
        },
        uploadImg: {
            deps: ['jquery'],
            exports: 'uploadImg'
        },
        checkSelect: {
            deps: ['jquery'],
            exports: 'checkSelect'
        },
        checkOne: {
            deps: ['jquery'],
            exports: 'checkOne'
        },
        jqueryUI: {
            deps: ['jquery'],
            exports: 'jqueryUI'
        },
        tableInit: {
            deps: ['jquery', 'jqueryDataTables'],
            exports: 'tableInit'
        },
        tableSearch: {
            deps: ['jquery', 'jqueryDataTables'],
            exports: 'tableSearch'
        }
    }
});

define(['jquery', 'checkSelect', 'checkOne', 'tableSearch', 'bootstrap', 'jqueryDataTables', 'dataTablesBootstrap', 'tableInit', 'newIframe', 'tableOption', 'preventBack', 'validate', 'messagesZh', 'validateExtend', 'jqueryUI'], function($, checkSelect, checkOne, tableSearch, validate, messagesZh, validateExtend) {
    console.log('setting')
    //冻结用户
    $("body").on("click", "#freeze", function() {
        if (checkSelect("请选择要冻结的用户")) {
            var url = $(this).attr("url");
            $(".main_form").attr("action", url);
            // alert(url);
            $('.main_form').submit();
        }
    })
    // 解冻用户
    $("body").on("click", "#thaw", function() {
        if (checkSelect("请选择要解冻的用户")) {

            var url = $(this).attr("url");
            $(".main_form").attr("action", url);
            // alert(url);
            $('.main_form').submit();
        }
    })


    $("#localSearch").click(function() {
        var val = $("input[name='search']").val();
        tableSearch(val);
    })

    

    $('form').validate({
        submitHandler: function(form) {
            console.log('submit')
            form.submit()
        }
    });
})